<template>
  <div class="divBox relative">
    <el-card class="box-card">
      
      
      <div class="container mt-1" style="height: 80vh;overflow: scroll;">
        <el-form ref="form" :model="form" label-width="180px">
          <!-- <el-form-item label="奖励金额" prop="reward_price">
            <el-input v-model="form.reward_price" size="small" placeholder="请输入合作商扫码奖励金额"  type="number"></el-input>
          </el-form-item>
          <el-form-item label="奖励描述">
		  	  <edit  ref="myEdit1" />
		  </el-form-item> -->
          <el-form-item label="合作商提现描述">
          <div style="z-index: 1000000;position: relative;">
                <edit  ref="myEdit2" />
             </div>
		  </el-form-item>
          <!-- <el-form-item label="状态" prop="status">
            <el-radio-group v-model="form.status">
              <el-radio label="1">启用</el-radio>
              <el-radio label="0">禁用</el-radio>
            </el-radio-group>
          </el-form-item> -->
          <!-- <el-form-item label="积分说明">
		  	  <edit  ref="myEdit3" />
		  </el-form-item> -->
          <el-form-item label="" prop="">
            <el-button type="primary" @click="submitForm" size="mini">保存设置</el-button>
          </el-form-item>
        </el-form>
      </div>
    </el-card>
  </div>
</template>

<script>
import  edit  from "@/components/wangEditor.vue"
export default {
  components:{
    edit
  },
  data() {
    return {
      form: {
		    desc:'', // 奖励描述
            reward_price:'', // 奖励金额
            tixin_desc:"",
            status:"1", // 状态 0：禁用 1：启用
            point_desc:"", // 积分描述
      },
      notic_url:'',
	  h5_url:''
    }
  },
  mounted() {
    // 初始化时加载已有的企业微信配置
	let cid = sessionStorage.getItem('cid')
	this.notic_url = '/index/callback' + cid
	this.h5_url = '/h5/#/?cid=' + cid
    this.loadSettings();
  },
  methods: {
    // 加载企业微信设置
    loadSettings() {
      
	  this.$api.post('/admin/getRewardDesc',{}).then(res=>{
	  	  if(res.data){
			//    this.$refs.myEdit1.html = res.data.desc
			   this.$refs.myEdit2.html = res.data.tixin_desc
			//    this.$refs.myEdit3.html = res.data.point_desc
            //    this.form.status = res.data.status
            //    this.form.reward_price = res.data.reward_price
		  }
	  })
    },
    
    // 提交表单
    submitForm() {
        let params = {
            // desc:this.$refs.myEdit1.html,
            // reward_price:this.form.reward_price,
            tixin_desc:this.$refs.myEdit2.html,
            // status:this.form.status,
            // point_desc:this.$refs.myEdit3.html,
        }
      this.$api.post('/admin/setRewardDesc',params).then(res=>{
      	  this.$message.success('操作成功')
		  this.loadSettings()
      })
    },
  }
}
</script>

<style lang="scss" scoped>
.divBox {
  
  .box-card {
    border-radius: 8px;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  }
  .font-w-b {
    font-weight: bold;
  }
  .font-16 {
    font-size: 16px;
  }
  .main-color-dan {
    color: #409EFF;
  }
  .mt-1 {
    margin-top: 10px;
  }
}
</style>